<?php

/**
 * @name: HOTN AnimeList
 * @author: HammerOnTheNail
 * @link: http://code.google.com/p/hotnanimelist/
 */

// Admin oldal címének meghatározása
$title .= " \ ".HOTN_ANIMELIST_ADMIN_MENU_ERROR_LIST;

// Date converter
$gen = new convert();

if ($qs[2]=="action" && $qs[3]<>"")
{
	// hiba részletes kiírása
	
	// Hiba adatok lekérése
	$sql->db_Select("hotn_animelist_error","*","`error_id` = '".(int)$qs[3]."'");
	$row = $sql->db_Fetch();
	
	// Form összeillesztése
	$data = array(
		"type" => "form",
		"method" => "post",
		"action" =>  e_PLUGIN ."hotn_animelist/Admin/error/admin_error_action.php",
		"hidden" => array(
							"action" => "delete",
							"error[]" => $row['error_id']
					),
		"data" => array(
					array(
						"type" => "form_title",
						"value" => $row['error_title']
					),
					array(
						"type" => "title",
						"value" => $gen->convert_date($row['error_datestamp']),
						"text" => HOTN_ANIMELIST_ADMIN_ERROR_TABLE_DATE
					),
					array(
						"type" => "title",
						"value" => $tp->toHTML($row['error_text']),
						"text" => HOTN_ANIMELIST_ADMIN_ERROR_TABLE_TEXT
					),
					array(
						"type" => "title",
						"value" => $row['error_url'],
						"text" => HOTN_ANIMELIST_ADMIN_ERROR_TABLE_URL
					),
					array(
						"type" => "submit",
						"value" => HOTN_ANIMELIST_ADMIN_ERROR_FORM_SUBMIT
					)
				)
	);
	
	// Form megjelenítése
	$text = $HOTN_ANIMELIST_FORM->show_form($data);
}
else
{
	// Hiba táblázatos kiírása
	
	// Megvizsgáljuk a hibák mennyiségét
	if ($sql->db_Select("hotn_animelist_error","*","ORDER BY error_datestamp ASC","non-default")<>0)
	{
			
		$text = "
		<form action='".e_PLUGIN."hotn_animelist/Admin/error/admin_error_action.php' method='post'>
		<input type='hidden' name='action' value='delete' />
			<table class='fborder'>
				<tr>
					<td class='fcaption'>
						".HOTN_ANIMELIST_ADMIN_ERROR_TABLE_TITLE."
					</td>
					<td class='fcaption'>
						".HOTN_ANIMELIST_ADMIN_ERROR_TABLE_DATE."
					</td>
					<td class='fcaption'>
						".HOTN_ANIMELIST_ADMIN_ERROR_TABLE_OPTIONS."
					</td>
				</tr>
		";
		
		while($row = $sql->db_Fetch())
		{
			$text .= "
				<tr>
					<td class='forumheader3'>
						<a href='".e_PLUGIN."hotn_animelist/Admin/admin_index.php?error.list.action.".$row['error_id']."'>".$row['error_title']."</a>
					</td>
					<td class='forumheader3'>
						".$gen->convert_date($row['error_datestamp'])."
					</td>
					<td class='forumheader3' style='text-align:center'>
						<input type='checkbox' class='tbox' name='error[]' value='".$row['error_id']."'>
					</td>
				</tr>
			";
		}
		
		$text .= "
				<tr>
					<td colspan='3' class='forumheader' style='text-align:center;'>
						<input type='submit' class='button' value='".HOTN_ANIMELIST_ADMIN_ERROR_FORM_SUBMIT."'>
					</td>
				</tr>
			</table>
		</form>";
	}
	else
	{
		// Nincs bejelentett hiba üzenet
		$text = HOTN_ANIMELIST_ADMIN_ERROR_NO_ITTEM;
	}
}

// Admin oldal tartalmának megjelenítése

$text = "<div style='text-align: center;'>".$text."</div>";
?>